package com.server.thisService.controller;
import com.project.thisCommon.annotation.MethodAuthority;
import com.project.thisCommon.model.BaseEntity;
import com.project.thisCommon.model.RequestBase;
import com.project.thisCommon.model.ResultBase;
import com.server.thisFacade.domain.reqeust.UserRequest;
import com.server.thisService.common.enums.SuccessCode;
import com.server.thisService.model.UserEntity;
import com.server.thisService.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.server.thisFacade.domain.result.UserResult;
import com.server.thisFacade.business.UserInfoInterface;

@RestController
public class UserInfoController implements UserInfoInterface {

    @Autowired
    UserService userService;

    @Override
    @MethodAuthority
    public ResultBase<UserResult> findUserInfo(@RequestBody RequestBase<UserRequest> userInfo) throws Exception {
        BaseEntity<UserEntity> find_en = new BaseEntity<>(userInfo);
        UserEntity user = userService.findUserInfo(find_en);
        return ResultBase.ok(user, SuccessCode.SYSTEM_SUCCESS);
    }
}
